<%@page import="domain.model.Emails"%>
<%@page import="java.util.Date"%>
<%@page import="domain.service.Utils"%>
<%@page import="domain.model.InOutLink"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="domain.model.Domain"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Collections"%>
<%@page import="javax.cache.CacheException"%>
<%@page import="javax.cache.CacheManager"%>
<%@page import="javax.cache.Cache"%>
<%@page import="domain.model.Whois"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>
<% request.setCharacterEncoding("utf-8");%>
<%
String title = (String) request.getAttribute("title");
String description = (String) request.getAttribute("description");
String keywords = (String) request.getAttribute("keyword");
Domain domain = (Domain) request.getAttribute("domain");
NumberFormat nf = NumberFormat.getInstance();
List<InOutLink> inlink = (List<InOutLink>) request.getAttribute("inlink");
List<InOutLink> outlink = (List<InOutLink>) request.getAttribute("outlink");
List<Whois> whois = (List<Whois>) request.getAttribute("whois");
List<Domain> otherDomain = (List<Domain>) request.getAttribute("otherDomain");
List<Emails> mails = (List<Emails>) request.getAttribute("emails");

Date date = new Date();
Date dates = new Date();
if(domain.getLastUpdateDate() != null)
{
	dates = domain.getLastUpdateDate();
}
long seconds = (date.getTime() - dates.getTime())/1000;
long day = (int) (seconds / 86400);
long hour = (int) ((seconds - day*86400) / 3600);
long minute = (int) ((seconds - day*86400 - hour*3600) / 60);

%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
	<jsp:param name="img" value="<%=domain.getName() %>"/>
</jsp:include>
		<div class="body all">
			<div class="cate">
				<%@ include file='/element/menu_left.jsp'%>
				<%@ include file='/adv/left_detail.jsp'%>
				<%@ include file='/element/new_site.jsp'%>
				<%@ include file='/element/random_site.jsp'%>
			</div>
			<div class="content">
				<%@ include file='/adv/menu.jsp'%>
				<h2 class="title left size_20">
					<%=domain.getName() %>
					<%
					if(day>=1 || domain.getLastUpdateDate() == null)
					{
					%>
								( <a href="javascript:void(0)" rel="nofollow" id="update">Update</a> )
					<%
					}
					%>
				</h2>
				
				<div class="add_this right zero_r">
					<!-- AddThis Button BEGIN -->
					<div class="addthis_toolbox addthis_default_style ">
					<a class="addthis_button_preferred_1"></a>
					<a class="addthis_button_preferred_2"></a>
					<a class="addthis_button_preferred_3"></a>
					<a class="addthis_button_preferred_4"></a>
					<a class="addthis_button_compact"></a>
					<a class="addthis_counter addthis_bubble_style"></a>
					</div>
					<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
					<!-- AddThis Button END -->
				</div>
				<div class="sum_one right">
					<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
					<g:plusone size="small" count="true"></g:plusone>
				</div>
				<div class="clear"></div>
				Updated<b>
				<%
					if(day > 0)
					{
						out.print(day+" days, ");
					}
					if(hour > 0)
					{
						out.print(hour+" hours, ");
					}
					out.print(minute+" minutes");
				%>	</b> Ago<br/><br/>
				<%@ include file='/adv/note.jsp'%>
				<br/><br/>
				<p>
					<strong><%=domain.getName() %></strong> <%=Utils.returnSubDomain(domain.getName()) %> ,has parerank is <strong><%=domain.getRankGoogle() %></strong> ,the domain is <strong><%=Utils.checkLengthDomain(domain.getName()) %></strong> characters in length,
					the number of visitors to the site an average of <%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*120)/0.03)):"-" %>
					,the average speed of the site is   <%=(domain.getSpeed()!=null)?domain.getSpeed():'-' %> .
				</p>
				<br/>
				<div class="ti">Ranking info</div>
				<ul class="detail">
					<li>
						<div class="detail_left left">Google pagerank:</div>
						<div class="detail_right left"><a href="http://prapi.net?url=<%=domain.getName()%>" target="_blank" rel="nofollow"><%=domain.getRankGoogle() %></a></div>
					</li>
					<li>
						<div class="detail_left left">Alexa rank:</div>
						<div class="detail_right left"><%=(domain.getRankAlexa() != 0)?nf.format(domain.getRankAlexa()):"-" %></div>
					</li>
				</ul>
				<%@ include file='/adv/menu.jsp'%>
				<div class="ti">Site info </div>
				<ul class="detail">
					<li>
						<div class="detail_left left">Domain</div>
						<div class="detail_right left">
							<%
							if(domain.getName()!=null)
							{
							%>
								<strong>
									<%=domain.getName() %>&nbsp;&nbsp;&nbsp;  
									<% if(domain.getShowsite() == 1 && domain.getSex() != 1){ %> | View <a href="http://www.showsiteinfo.org/sites/<%=domain.getName()%>" target="_blank"> <%=domain.getName()%> </a> in showsiteinfo<% } %>
								</strong>
								<br/><strong>Length : <%=Utils.checkLengthDomain(domain.getName()) %></strong>
								characters
							<%
							} else {
								out.println(domain.getName());
							}
							%>
							
						</div>
					</li>
					<li>
						<div class="detail_left left">5ty.org</div>
						<div class="detail_right left">
							View <a href="http://5ty.org/d/<%=domain.getName() %>" target="_blank"><%=domain.getName() %></a> in 5ty.org
						</div>
					</li>
					<%
					if(otherDomain.size()>0)
					{
					%>
					<li>
						<div class="detail_left left">Other Domain</div>
						<div class="detail_right left">
							<%
								for(int i=0;i<otherDomain.size();i++)
								{
									out.println("<a href='/domain/"+otherDomain.get(i).getName()+"'>"+otherDomain.get(i).getName()+"</a>");
									if(i!=(otherDomain.size()-1))
										out.println(" , ");
								}
							%>
						</div>
					</li>
					<%
					}
					%>
					<li>
						<div class="detail_left left">Title</div>
						<div class="detail_right left">
							<%
							if(domain.getTitle()!=null && domain.getSex() != 1)
							{
							%>
								<%=domain.getTitle() %>
								<br/><strong>Length : <%=domain.getTitle().length() %></strong>
								characters
							<%
							} else {
								out.println(domain.getName());
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Keywords</div>
						<div class="detail_right left">
							<%
							if(domain.getSex() != 1)
							{
							%>
								<%=domain.getKeywordString().replaceAll("[ ]+[,]+[ ]+$","") %>
								<br/><strong>Length : <%=domain.getKeywordString().replaceAll("[ ]+[,]+[ ]+$","").replaceAll("\\<.*?\\>", "").length() %></strong>
								characters
								<br/><strong>Numbers : <%=domain.getKeywords().size() %></strong>
								keywords
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Popular Keywords</div>
						<div class="detail_right left">
							<%
							if(domain.getSex() != 1)
							{
							%>
							<%=domain.getPopularKeywordString().replaceAll("[ ]+[,]+[ ]+$","") %>
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Description</div>
						<div class="detail_right left">
							<%
							if(domain.getDescription() != null && domain.getSex() != 1)
							{
							%>
								<%=domain.getDescription().getValue() %>
								<br/><strong>Length : <%=domain.getDescription().getValue().length() %></strong>
								characters
							<%
							} else {
								out.println("No description");
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Estimate Visitor per Day:</div>
						<div class="detail_right left"><%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*120)/0.03)):"-" %></div>
					</li>
					<li>
						<div class="detail_left left">Speed site:</div>
						<div class="detail_right left"><%=(domain.getSpeed()!=null)?domain.getSpeed():'-' %></div>
					</li>
					<li>
						<div class="detail_left left">Domain Age:</div>
						<div class="detail_right left"><%=(domain.getDomainAge()!=null)?domain.getDomainAge():"-" %></div>
					</li>
					<li>
						<div class="detail_left left">Charset:</div>
						<div class="detail_right left"><%=(domain.getCharset()!=null)?domain.getCharset():"-" %></div>
					</li>
					<li>
						<div class="detail_left left">WOT:</div>
						<div class="detail_right left"><%=domain.getField8() %></div>
					</li>
				</ul>
				<div class="ti">Site Contact Info</div>
				<ul class="detail">
					<li>
						<div class="detail_left left">
							Email:<br/>
							<%=(whois.size()>0&&whois.get(0).getEmail()!=null&& domain.getSex() != 1)?whois.get(0).getEmailString():"-" %>
						</div>
						<div class="detail_right left">
							<%
							ArrayList<String> list = new ArrayList<String> ();
							if(mails!=null && mails.size()>0)
							{
								for(int i=0;i<mails.size();i++)
								{
									if(!list.contains(mails.get(i).getDomain()))
									{
										list.add(mails.get(i).getDomain());
							%>
									<a href="/domain/<%=mails.get(i).getDomain()%>"><%=mails.get(i).getDomain()%></a> <%=(i!=(mails.size()-1))?" , ":"" %> 
							<%
									}
								}
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Site's same Google Analytic (<%=domain.getGoogleAnalytic() %>):</div>
						<div class="detail_right left"><%=(request.getAttribute("sameAnalytic") != null && !request.getAttribute("sameAnalytic").equals(""))?request.getAttribute("sameAnalytic").toString().replaceAll("[ ]+[,]+[ ]+$",""):"Unknown"%></div>
					</li>
					<li>
						<div class="detail_left left">Site's same Google Adsense (<%=domain.getGoogleAdsense() %>):</div>
						<div class="detail_right left"><%=(request.getAttribute("sameAds") != null && !request.getAttribute("sameAds").equals(""))?request.getAttribute("sameAds").toString().replaceAll("[ ]+[,]+[ ]+$",""):"Unknown"%></div>
					</li>
				</ul>
				<div class="ti">Site Technical Info</div>
				<ul class="detail">
					<li>
						<div class="detail_left left">Programming Language:</div>
						<div class="detail_right left"><%=(domain.getProgramingLanguage()!=null)?domain.getProgramingLanguage():"-" %></div>
					</li>
					<li>
						<div class="detail_left left">Web server:</div>
						<div class="detail_right left"><%=(domain.getWebserver()!=null)?domain.getWebserver():"-" %></div>
					</li>
					<li>
						<div class="detail_left left">Javascript library:</div>
						<div class="detail_right left"><%=domain.getJsString().replaceAll("[ ]+[,]+[ ]+$","") %></div>
					</li>
					<li>
						<div class="detail_left left">IP Address:</div>
						<div class="detail_right left">
							<%
								if(domain.getIp() != null)
								{	
									String[] ips = domain.getIp().split("\n");
									for(int i=0;i<ips.length;i++)
									{			
							%>
										<a href="/ip/<%=ips[i] %>" title="Lookup Ip <%=ips[i] %>"><%=ips[i] %></a><br/>
							<%			
									}
								} else {
									out.println(domain.getName());
								}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Whois: <% if(whois.size() >0)out.println("<a href='/whois/"+domain.getName()+"'>( More detail... )</a>"); %></div>
						<div class="detail_right left whoiss">
							<%
								if(whois.size() > 0)
								{
									out.println(Utils.returnWhois(whois.get(0).getWhois().getValue()));
								} else {
									out.println("<a href='/whois/"+domain.getName()+"'>Update whois</a>");
								}
							%>
						</div>
					</li>
				</ul>
				<div class="ti">Site Seo</div>
				<ul class="detail">
					<li>
						<div class="detail_left left">Tag :</div>
						<div class="detail_right left">
							<table>
								<tr>
									<td>H1</td>
									<td>H2</td>
									<td>H3</td>
									<td>H4</td>
									<td>H5</td>
								</tr>
								<tr>
									<td><strong><%=domain.getH1().size() %></strong></td>
									<td><strong><%=domain.getH2().size() %></strong></td>
									<td><strong><%=domain.getH3().size() %></strong></td>
									<td><strong><%=domain.getH4().size() %></strong></td>
									<td><strong><%=domain.getH5().size() %></strong></td>
								</tr>
							</table>
							<%
							if(domain.getSex() != 1)
							{
							%>
							<a href="javascript:void(0)" class="click_view">View tag</a>
							<div class="view_tag">
								<%
								for(int i=0;i<domain.getH1().size();i++)
								{
								%>
									<strong>[H1]</strong> <%=domain.getH1().get(i) %>.<br/>
								<%
								}
								%>
								<%
								for(int i=0;i<domain.getH2().size();i++)
								{
								%>
									<strong>[H2]</strong> <%=domain.getH2().get(i) %>.<br/>
								<%
								}
								%>
								<%
								for(int i=0;i<domain.getH3().size();i++)
								{
								%>
									<strong>[H3]</strong> <%=domain.getH3().get(i) %>.<br/>
								<%
								}
								%>
								<%
								for(int i=0;i<domain.getH4().size();i++)
								{
								%>
									<strong>[H4]</strong> <%=domain.getH4().get(i) %>.<br/>
								<%
								}
								%>
								<%
								for(int i=0;i<domain.getH5().size();i++)
								{
								%>
									<strong>[H5]</strong> <%=domain.getH5().get(i) %>.<br/>
								<%
								}
								%>
							</div>
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Image:</div>
						<div class="detail_right left">
							You have <strong><%=domain.getImg().size() %></strong> images on this website.
							<%
							if(domain.getSex() != 1)
							{
							%>
							<% if(domain.getImg().size()>0){ %><a href="javascript:void(0)" class="click_image">View link</a><% } %>
							<div class="view_image">
								<%
								for(int i=0;i<domain.getImg().size();i++)
								{
								%>
									<strong><%=(i+1) %> : </strong> <%=domain.getImg().get(i) %>.<br/>
								<%
								}
								%>
							</div>
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Frame:</div>
						<div class="detail_right left"><%=(domain.getFrame()==0)?"No":"Yes" %></div>
					</li>
					<li>
						<div class="detail_left left">Flash:</div>
						<div class="detail_right left">
							You have <strong><%=domain.getFlash().size() %></strong> flash on this website.
							<%
							if(domain.getSex() != 1)
							{
							%>
							<% if(domain.getFlash().size()>0){ %><a href="javascript:void(0)" class="click_flash">View link</a><% } %>
							<div class="view_flash">
								<%
								for(int i=0;i<domain.getFlash().size();i++)
								{
								%>
									<strong><%=(i+1) %> : </strong> <%=domain.getFlash().get(i) %>.<br/>
								<%
								}
								%>
							</div>
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="detail_left left">Size:</div>
						<div class="detail_right left"><%=(domain.getSize()!=0)?"<b>"+nf.format(domain.getSize())+"</b> Characters":"-" %></div>
					</li>
					<li>
						<div class="detail_left left">Meta Description:</div>
						<div class="detail_right left"><%=(domain.getMetaDesc()!=0)?"Yes":"No" %></div>
					</li>
					<li>
						<div class="detail_left left">Meta Keyword:</div>
						<div class="detail_right left"><%=(domain.getMetaKey()!=0)?"Yes":"No" %></div>
					</li>
				</ul>
				<%
				if(domain.getSex() != 1)
				{
				%>
				<div class="ti">Cross link</div>
				<ul class="detail">
					<%
					if(outlink.size() > 0)
					{
					%>
						<li>
							<div class="detail_left left">Out link: <a href="/link-out/<%=domain.getName()%>">View all</a></div>
							<div class="detail_right left">
								<ul class="list_link">
									<%
									for(int i=0;i<outlink.size();i++)
									{
									%>
										<li>
											<span class="left">http://<%=outlink.get(i).getOutLink() %></span>
											<a href="/domain/<%=outlink.get(i).getOutLink() %>" class="right">View infomation</a>
											<div class="clear"></div>
										</li>
									<%
									}
									%>
								</ul>
							</div>
						</li>
					<%
					}
					%>
					<%
					if(inlink.size() > 0)
					{
					%>
						<li>
							<div class="detail_left left">In link: <a href="/link-in/<%=domain.getName()%>">View all</a></div>
							<div class="detail_right left">
								<ul class="list_link">
									<%
									for(int i=0;i<inlink.size();i++)
									{
									%>
										<li>
											<span>http://<%=inlink.get(i).getInLink() %></span>
											<a href="/domain/<%=inlink.get(i).getInLink() %>" class="right">View infomation</a>
											<div class="clear"></div>
										</li>
									<%
									}
									%>
								</ul>
							</div>
						</li>
					<%
					}
					%>
				</ul>
				<%
				}
				%>
				<div class="ti">Domain Traffic Graph</div>
				<div>
					<div class="daily left">Daily Rank</div>
					<div class="daily right">Daily PageViews</div>
					<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=t&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF" class="left"/>
					<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=r&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF" class="right"/>
					<div class="clear"></div>
				</div>
				<div class="ti">Other sites hosted on</div>
				<ul class="detail">
					<%=(request.getAttribute("sameip") != null && !request.getAttribute("sameip").equals(""))?request.getAttribute("sameip"):"Unknown" %>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
		<script type="text/javascript"src="/js/jquery.js"></script>
		<script type="text/javascript"src="/js/re_details.js"></script>
		<script type="text/javascript">
			var domain = '<%=domain.getName()%>';
		</script>
		<div id='opacity'></div>
<img src="/images/ajax-loader.gif" id='image_loadder'/>
<%@ include file='/layout/footer.jsp'%>